#include "KeyManager.h"
#include <SDL.h>

KeyManager * KeyManager::_self = 0;

KeyManager * KeyManager::instance()
{
	if (!_self)
		_self = new KeyManager;
	return _self;
}

bool KeyManager::isKeyDown(Key key)
{
	Uint8 * key_status = SDL_GetKeyState(NULL);

	if (key == GKEY_W)
		return key_status[SDLK_w];
	if (key == GKEY_S)
		return key_status[SDLK_s];
	if (key == GKEY_A)
		return key_status[SDLK_a];
	if (key == GKEY_D)
		return key_status[SDLK_d];
	return false;
}

KeyManager::KeyManager(void)
{
}
